package src;

import pjwstk.jps.ast.IExpression;
import pjwstk.jps.ast.auxname.AsExpression;
import pjwstk.jps.ast.auxname.GroupAsExpression;
import pjwstk.jps.ast.binary.AndExpression;
import pjwstk.jps.ast.binary.CommaExpression;
import pjwstk.jps.ast.binary.DivideExpression;
import pjwstk.jps.ast.binary.DotExpression;
import pjwstk.jps.ast.binary.EqualsExpression;
import pjwstk.jps.ast.binary.ForAllExpression;
import pjwstk.jps.ast.binary.ForAnyExpression;
import pjwstk.jps.ast.binary.GreaterOrEqualThanExpression;
import pjwstk.jps.ast.binary.GreaterThanExpression;
import pjwstk.jps.ast.binary.InExpression;
import pjwstk.jps.ast.binary.IntersectExpression;
import pjwstk.jps.ast.binary.JoinExpression;
import pjwstk.jps.ast.binary.LessOrEqualThanExpression;
import pjwstk.jps.ast.binary.LessThanExpression;
import pjwstk.jps.ast.binary.MinusExpression;
import pjwstk.jps.ast.binary.MinusSetExpression;
import pjwstk.jps.ast.binary.ModuloExpression;
import pjwstk.jps.ast.binary.MultiplyExpression;
import pjwstk.jps.ast.binary.OrExpression;
import pjwstk.jps.ast.binary.PlusExpression;
import pjwstk.jps.ast.binary.UnionExpression;
import pjwstk.jps.ast.binary.WhereExpression;
import pjwstk.jps.ast.binary.XORExpression;
import pjwstk.jps.ast.terminal.BooleanTerminal;
import pjwstk.jps.ast.terminal.DoubleTerminal;
import pjwstk.jps.ast.terminal.IntegerTerminal;
import pjwstk.jps.ast.terminal.NameTerminal;
import pjwstk.jps.ast.terminal.StringTerminal;
import pjwstk.jps.ast.unary.BagExpression;
import pjwstk.jps.ast.binary.NAndExpression;
import pjwstk.jps.ast.unary.CountExpression;
import pjwstk.jps.ast.unary.EmptyExpression;
import pjwstk.jps.ast.unary.MaxExpression;
import pjwstk.jps.ast.unary.MinExpression;
import pjwstk.jps.ast.unary.NotExpression;
import pjwstk.jps.ast.unary.StructExpression;
import pjwstk.jps.ast.unary.SumExpression;
import pjwstk.jps.ast.unary.UniqueExpression;
import pjwstk.jps.datastore.SBAStore;
import pjwstk.jps.interpreter.envs.ENVS;
import pjwstk.jps.interpreter.envs.Interpreter;
import pjwstk.jps.interpreter.qres.QResStack;
import pjwstk.jps.result.IAbstractQueryResult;

/**
 * @author s9111_s10304
 *
 */
public class Main6 {

    /**
     * @param args
     */
    @SuppressWarnings("unused")
    public static void main(String[] args) {
        // pr6 - Operatory II
        System.out.println("pr6 - Operatory II");
        
        ENVS envs1 = new ENVS();           // envs1||
        QResStack qres1 = new QResStack(); // qres1||
        SBAStore store1 = new SBAStore();  // store1||
        
        store1.loadXML(".\\s9111_s10304_pr6\\res\\testdata.xml");
        envs1.init(store1.getEntryOID(), store1);
        store1.PrintObjects(store1.retrieve(store1.getEntryOID()));
        System.out.println(store1.getString());

        Interpreter interpreter = new Interpreter(store1);

        // all 1 true
        IExpression expression1 =
                new ForAllExpression(
                    new IntegerTerminal(1),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult1 = interpreter.eval(expression1);
        System.out.println("ex1: all 1 true = "+queryResult1.toString());
        
        
        // all (bag(1, bag(2,3) group as wew) as num) (num == 2)
        IExpression expression2 =
                new ForAllExpression(
                    new AsExpression(
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new GroupAsExpression(
                                    new BagExpression(
                                        new CommaExpression(
                                            new IntegerTerminal(2),
                                            new IntegerTerminal(3)
                                        )
                                    ),
                                    new NameTerminal("wew").getName()
                                )
                            )
                        ),
                        new NameTerminal("num").getName()
                    ),
                    new EqualsExpression(
                        new StringTerminal("num"),
                        new IntegerTerminal(2)
                    )
                );
        
        IAbstractQueryResult queryResult2 = interpreter.eval(expression2);
        System.out.println("ex2: all (bag(1, bag(2,3) group as wew) as num) (num == 2) = "+queryResult2.toString());
        

        // all emp married
        IExpression expression3 =
                new ForAllExpression(
                    new NameTerminal("emp"),
                    new NameTerminal("married")
                );
        
        IAbstractQueryResult queryResult3 = interpreter.eval(expression3);
        System.out.println("ex3: all emp married = "+queryResult3.toString());
        

        // true and false
        IExpression expression4 =
                new AndExpression(
                    new BooleanTerminal(true),
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult4 = interpreter.eval(expression4);
        System.out.println("ex4: true and false = "+queryResult4.toString());
        

        // booleanValue and true
        IExpression expression5 =
                new AndExpression(
                    new NameTerminal("booleanValue"),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult5 = interpreter.eval(expression5);
        System.out.println("ex5: booleanValue and true = "+queryResult5.toString());

        
        // false and true and 1
        IExpression expression6 =
                new AndExpression(
                    new AndExpression(
                        new BooleanTerminal(false),
                        new BooleanTerminal(true)
                    ),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult6 = interpreter.eval(expression6);
        System.out.println("ex6: false and true and 1 = "+queryResult6.toString());

        
        // any 1 true
        IExpression expression7 =
                new ForAnyExpression(
                    new IntegerTerminal(1),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult7 = interpreter.eval(expression7);
        System.out.println("ex7: any 1 true = " + queryResult7.toString());
        
        
        // any emp married
        IExpression expression8 =
                new ForAnyExpression(
                    new NameTerminal("emp"),
                    new NameTerminal("married")
                );
        
        IAbstractQueryResult queryResult8 = interpreter.eval(expression8);
        System.out.println("ex8: any emp married = " + queryResult8.toString());
        
        
        // 1 as someName
        IExpression expression9 =
                new AsExpression(
                    new IntegerTerminal(1),
                    new NameTerminal("someName").getName()
                );
    
        IAbstractQueryResult queryResult9 = interpreter.eval(expression9);
        System.out.println("ex9: 1 as someName = "+queryResult9.toString());
        

        // bag(1,2) as someName
        IExpression expression10 =
                new AsExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new NameTerminal("someName").getName()
                );
    
        IAbstractQueryResult queryResult10 = interpreter.eval(expression10);
        System.out.println("ex10: bag(1, 2) as someName = "+queryResult10.toString());
        
        
        // (1, 2) as someName
        IExpression expression11 =
                new AsExpression(
                    new CommaExpression(
                        new IntegerTerminal(1),
                        new IntegerTerminal(2)
                    ),
                    new NameTerminal("someName").getName()
                );
    
        IAbstractQueryResult queryResult11 = interpreter.eval(expression11);
        System.out.println("ex11: (1, 2) as someName = "+queryResult11.toString());
        

        // bag(1)
        IExpression expression12 =
                new BagExpression(
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult12 = interpreter.eval(expression12);
        System.out.println("ex12: bag(1) = "+queryResult12.toString());
        
        
        // bag(1, 2, 3)
        IExpression expression13 =
                new BagExpression(
                    new CommaExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        ),
                        new IntegerTerminal(3)
                    )
                );
        
        IAbstractQueryResult queryResult13 = interpreter.eval(expression13);
        System.out.println("ex13: bag(1, 2, 3) = "+queryResult13.toString());
        
        
        // bag(1+2,3)
        IExpression expression14 =
                new BagExpression(
                    new CommaExpression(
                        new PlusExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        ),
                        new IntegerTerminal(3)
                    )
                );
        
        IAbstractQueryResult queryResult14 = interpreter.eval(expression14);
        System.out.println("ex14: bag(1+2, 3) = "+queryResult14.toString());
        
        
        // bag(bag(1,2,3))
        IExpression expression15 =
                new BagExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult15 = interpreter.eval(expression15);
        System.out.println("ex15: bag(bag(1,2,3)) = "+queryResult15.toString());
        
        
        // integerNumber
        IExpression expression16 =
                new NameTerminal("integerNumber");
        
        IAbstractQueryResult queryResult16 = interpreter.eval(expression16);
        System.out.println("ex16: integerNumber = "+queryResult16.toString());
        

        // realNumber
        IExpression expression17 =
                new NameTerminal("realNumber");
        
        IAbstractQueryResult queryResult17 = interpreter.eval(expression17);
        System.out.println("ex17: realNumber = "+queryResult17.toString());
        
        
        // booleanValue
        IExpression expression18 =
                new NameTerminal("booleanValue");
        
        IAbstractQueryResult queryResult18 = interpreter.eval(expression18);
        System.out.println("ex18: booleanValue = "+queryResult18.toString());
        

        // stringValue
        IExpression expression19 =
                new NameTerminal("stringValue");
        
        IAbstractQueryResult queryResult19 = interpreter.eval(expression19);
        System.out.println("ex19: stringValue = "+queryResult19.toString());
        
        
        // pomidor
        IExpression expression20 =
                new NameTerminal("pomidor");
        
        IAbstractQueryResult queryResult20 = interpreter.eval(expression20);
        System.out.println("ex20: pomidor = "+queryResult20.toString());
        
        
        // sampleComplexObj
        IExpression expression21 =
                new NameTerminal("sampleComplexObj");
        
        IAbstractQueryResult queryResult21 = interpreter.eval(expression21);
        System.out.println("ex21: sampleComplexObj = "+queryResult21.toString());
        

        // (1, 2)
        IExpression expression22 =
                new CommaExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(2)
                );
        
        IAbstractQueryResult queryResult22 = interpreter.eval(expression22);
        System.out.println("ex22: (1, 2) = "+queryResult22.toString());
        
        
        // (bag(1, 2), 3)
        IExpression expression23 =
                new CommaExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new IntegerTerminal(3)
                );

        IAbstractQueryResult queryResult23 = interpreter.eval(expression23);
        System.out.println("ex23: (bag(1, 2), 3) = "+queryResult23.toString());
        
        
        // (bag(1, 2), bag(3, 4))
        IExpression expression24 =
                new CommaExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(3),
                            new IntegerTerminal(4)
                        )
                    )
                );

        IAbstractQueryResult queryResult24 = interpreter.eval(expression24);
        System.out.println("ex24: (bag(1, 2), bag(3, 4)) = "+queryResult24.toString());
        
        
        // 10 / 5
        IExpression expression25 = 
                new DivideExpression(
                    new IntegerTerminal(10),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult25 = interpreter.eval(expression25);
        System.out.println("ex25: 10 / 5 = "+queryResult25.toString());
        
        
        // 5 / 3.50
        IExpression expression26 = 
                new DivideExpression(
                    new IntegerTerminal(5),
                    new DoubleTerminal(3.50)
                );
        
        IAbstractQueryResult queryResult26 = interpreter.eval(expression26);
        System.out.println("ex26: 5 / 3.50 = "+queryResult26.toString());
        
        
        // 3.50 / 5
        IExpression expression27 = 
                new DivideExpression(
                    new DoubleTerminal(3.50),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult27 = interpreter.eval(expression27);
        System.out.println("ex27: 3.50 / 5 = "+queryResult27.toString());

        
        // 3.50 / 5.50
        IExpression expression28 = 
                new DivideExpression(
                    new DoubleTerminal(3.50),
                    new DoubleTerminal(5.50)
                );
        
        IAbstractQueryResult queryResult28 = interpreter.eval(expression28);
        System.out.println("ex28: 3.50 / 5.50 = "+queryResult28.toString());

        
        // (1 as x).(x)
        IExpression expression29 =
                new DotExpression(
                    new AsExpression(
                        new IntegerTerminal(1),
                        new NameTerminal("x").getName()
                    ),
                    new NameTerminal("x")
                );
    
        IAbstractQueryResult queryResult29 = interpreter.eval(expression29);
        System.out.println("ex29: (1 as x).(x) = "+queryResult29.toString());

        
        // (1, 2).("Ala")
        IExpression expression30 =
                new DotExpression(
                    new CommaExpression(
                        new IntegerTerminal(1),
                        new IntegerTerminal(2)
                    ),
                    new StringTerminal("Ala")
                );
    
        IAbstractQueryResult queryResult30 = interpreter.eval(expression30);
        System.out.println("ex30: (1, 2).(\"Ala\") = "+queryResult30.toString());
        
        
        // emp.book.author
        IExpression expression31 = 
                new DotExpression(
                    new DotExpression(
                        new NameTerminal("emp"),
                        new NameTerminal("book")
                    ),
                    new NameTerminal("author")
                );
        
        IAbstractQueryResult queryResult31 = interpreter.eval(expression31);
        System.out.println("ex31: emp.book.author = "+queryResult31.toString());
        
        
        // bag(1, 2).("Ala") 
        IExpression expression32 =
                new DotExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new StringTerminal("Ala")
                );
    
        IAbstractQueryResult queryResult32 = interpreter.eval(expression32);
        System.out.println("ex32: bag(1, 2).(\"Ala\") = "+queryResult32.toString());
        
        
        // 1 == 2
        IExpression expression33 = 
                new EqualsExpression(
                       new IntegerTerminal(1),
                       new IntegerTerminal(2)
                );
       
        IAbstractQueryResult queryResult33 = interpreter.eval(expression33);
        System.out.println("ex33: (1 == 2) = "+queryResult33.toString());
      

        // integerNumber == 10
        IExpression expression34 =
                new EqualsExpression(
                    new NameTerminal("integerNumber"),
                    new IntegerTerminal(10)
                );
       
        IAbstractQueryResult queryResult34 = interpreter.eval(expression34);
        System.out.println("ex34: (integerNumber == 10) = "+queryResult34.toString());
       
/*
        // bag(1, 2) == 2
        IExpression expression35 = 
                new EqualsExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new IntegerTerminal(2)
                );
       
        IAbstractQueryResult queryResult35 = interpreter.eval(expression35);
        System.out.println("ex35: (bag(1, 2) == 2) = "+queryResult35.toString());
        
        // Above should be an Exception before evaluation.
        // (There is an exception before evaluation so this example is commented.)
*/

        // booleanValue == true
        IExpression expression36 =
                new EqualsExpression(
                    new NameTerminal("booleanValue"),
                    new BooleanTerminal(true)
                );
       
        IAbstractQueryResult queryResult36 = interpreter.eval(expression36);
        System.out.println("ex36: (booleanValue == true) = "+queryResult36.toString());


        // stringValue == "Ala"
        IExpression expression37 =
                new EqualsExpression(
                    new NameTerminal("stringValue"),
                    new StringTerminal("Ala")
                );
       
        IAbstractQueryResult queryResult37 = interpreter.eval(expression37);
        System.out.println("ex37: (stringValue == \"Ala\") = "+queryResult37.toString());
       
       
        // 1 == true
        IExpression expression38 = 
                new EqualsExpression(
                    new IntegerTerminal(1),
                    new BooleanTerminal(true)
                );
       
        IAbstractQueryResult queryResult38 = interpreter.eval(expression38);
        System.out.println("ex38: (1 == true) = "+queryResult38.toString());
             
       
        // 5 == "5"
        IExpression expression39 =
                new EqualsExpression(
                    new IntegerTerminal(5),
                    new StringTerminal("5")
                );
       
        IAbstractQueryResult queryResult39 = interpreter.eval(expression39);
        System.out.println("ex39: (5 == \"5\") = "+queryResult39.toString());


        // 5.50 == 5
        IExpression expression40 =
                new EqualsExpression(
                    new DoubleTerminal(5.50),
                    new IntegerTerminal(5)
                );
      
        IAbstractQueryResult queryResult40 = interpreter.eval(expression40);
        System.out.println("ex40: (5.50 == 5) = "+queryResult40.toString());
      
      
        // 1 > 1
        IExpression expression41 =
                new GreaterThanExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(1)
                );

        IAbstractQueryResult queryResult41 = interpreter.eval(expression41);
        System.out.println("ex41: (1 > 1) = "+queryResult41.toString());
      
      
        // 3 > 2.99
        IExpression expression42 =
                new GreaterThanExpression(
                    new IntegerTerminal(3),
                    new DoubleTerminal(2.99)
                );

        IAbstractQueryResult queryResult42 = interpreter.eval(expression42);
        System.out.println("ex42: (3 > 2.99) = "+queryResult42.toString());
      
      
        // 24.35 >= 24.34
        IExpression expression43 =
                new GreaterOrEqualThanExpression(
                    new DoubleTerminal(24.35),
                    new DoubleTerminal(24.34)
                );

        IAbstractQueryResult queryResult43 = interpreter.eval(expression43);
        System.out.println("ex43: (24.35 >= 24.34) = "+queryResult43.toString());
      

        // bag(1, 2, 3) group as num
        IExpression expression44 =
                new GroupAsExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    ),
                    new NameTerminal("num").getName()
                );
      
        IAbstractQueryResult queryResult44 = interpreter.eval(expression44);
        System.out.println("ex44: bag(1, 2, 3) group as num = "+queryResult44.toString());
        
        
        // 1 group as liczba
        IExpression expression45 =
                new GroupAsExpression(
                    new IntegerTerminal(1),
                    new NameTerminal("liczba").getName()
                );
        
        IAbstractQueryResult queryResult45 = interpreter.eval(expression45);
        System.out.println("ex45: 1 group as liczba = "+queryResult45.toString());
        
        
        // bag(1, 2, 3) intersect bag(2, 3)
        IExpression expression46 =
                new IntersectExpression(
                    new BagExpression(
                        new BagExpression(
                            new CommaExpression(
                                new CommaExpression(
                                    new IntegerTerminal(1),
                                    new IntegerTerminal(2)
                                ),
                                new IntegerTerminal(3)
                            )
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new IntegerTerminal(3)
                        )
                    )   
                );
      
        IAbstractQueryResult queryResult46 = interpreter.eval(expression46);
        System.out.println("ex46: bag(1, 2, 3) intersect bag(2, 3) = "+queryResult46.toString());
        
        
        // 1 intersect 1
        IExpression expression47 =
                new IntersectExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult47 = interpreter.eval(expression47);
        System.out.println("ex47: 1 intersect 1 = "+queryResult47.toString());
        

        // (1, 2) intersect (2, 3)
        IExpression expression48 =
                new IntersectExpression(
                    new CommaExpression(
                        new IntegerTerminal(1),
                        new IntegerTerminal(2)
                    ),
                    new CommaExpression(
                        new IntegerTerminal(2),
                        new IntegerTerminal(3)
                    )
                );
        
        IAbstractQueryResult queryResult48 = interpreter.eval(expression48);
        System.out.println("ex48: (1, 2) intersect (2, 3) = "+queryResult48.toString());
        

        // bag(1, 2) intersect bag(1, 2)
        IExpression expression49 =
                new IntersectExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult49 = interpreter.eval(expression49);
        System.out.println("ex49: bag(1, 2) intersect bag(1, 2) = "+queryResult49.toString());
        
        
        // bag("ala", 2, 3) intersect bag(2, 3.40)
        IExpression expression50 =
                new IntersectExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new StringTerminal("ala"),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new DoubleTerminal(3.40)
                        )
                    )
                );

        IAbstractQueryResult queryResult50 = interpreter.eval(expression50);
        System.out.println("ex50: bag(\"ala\", 2, 3) intersect bag(2, 3.40) = "+queryResult50.toString());
        
        
        // 1 join 2
        IExpression expression51 =
                new JoinExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(2)
                );
        
        IAbstractQueryResult queryResult51 = interpreter.eval(expression51);
        System.out.println("ex51: 1 join 2 = "+queryResult51.toString());
        
        
        // (1 as n) join n
        IExpression expression52 =
                new JoinExpression(
                    new AsExpression(
                        new IntegerTerminal(1),
                        new NameTerminal("n").getName()
                    ),
                    new NameTerminal("n")
                );
        
        IAbstractQueryResult queryResult52 = interpreter.eval(expression52);
        System.out.println("ex52: (1 as n) join n = " + queryResult52.toString());
        

        // bag(emp) join bag(married)
        IExpression expression53 =
                new JoinExpression(
                    new BagExpression(
                        new NameTerminal("emp")
                    ),
                    new BagExpression(
                        new NameTerminal("married")
                    )
                );
        
        IAbstractQueryResult queryResult53 = interpreter.eval(expression53);
        System.out.println("ex53: bag(emp) join bag(married) = " + queryResult53.toString());

        
        // (emp as e) join (e.married)
        IExpression expression54 =
                new JoinExpression(
                    new AsExpression(
                        new NameTerminal("emp"),
                        new NameTerminal("e").getName()
                    ),
                    new DotExpression(
                        new NameTerminal("e"),
                        new NameTerminal("married")
                    )
                );
        
        IAbstractQueryResult queryResult54 = interpreter.eval(expression54);
        System.out.println("ex54: (emp as e) join (e.married)  = " + queryResult54.toString());
        

        // 1 <= 1
        IExpression expression55 = 
                 new LessOrEqualThanExpression(
                     new IntegerTerminal(1),
                     new IntegerTerminal(1)
                 );
        
        IAbstractQueryResult queryResult55 = interpreter.eval(expression55);
        System.out.println("ex55: (1 <= 1) = "+queryResult55.toString());



        // 24.34 <= 24.35
        IExpression expression56 =
                 new LessOrEqualThanExpression(
                     new DoubleTerminal(24.34),
                     new DoubleTerminal(24.35)
                 );
        
        IAbstractQueryResult queryResult56 = interpreter.eval(expression56);
        System.out.println("ex56: (24.34 <= 24.35) = "+queryResult56.toString());


        // 2.99 <= 3
        IExpression expression57 =
                 new LessOrEqualThanExpression(
                     new DoubleTerminal(2.99),
                     new IntegerTerminal(3)
                 );
        
        IAbstractQueryResult queryResult57 = interpreter.eval(expression57);
        System.out.println("ex57: (2.99 <= 3) = "+queryResult57.toString());

        
        // 1 < 1
        IExpression expression58 = 
                 new LessThanExpression(
                     new IntegerTerminal(1),
                     new IntegerTerminal(1)
                 );
        
        IAbstractQueryResult queryResult58 = interpreter.eval(expression58);
        System.out.println("ex58: (1 < 1) = "+queryResult58.toString());
        
        
        // 24.34 < 24.35
        IExpression expression59 =
                 new LessThanExpression(
                     new DoubleTerminal(24.34),
                     new DoubleTerminal(24.35)
                 );
        
        IAbstractQueryResult queryResult59 = interpreter.eval(expression59);
        System.out.println("ex59: (24.34 < 24.35) = "+queryResult59.toString());


        // 2.99 < 3
        IExpression expression60 =
                 new LessThanExpression(
                     new DoubleTerminal(2.99),
                     new IntegerTerminal(3)
                 );
        
        IAbstractQueryResult queryResult60 = interpreter.eval(expression60);
        System.out.println("ex60: (2.99 < 3) = "+queryResult60.toString());
        

        // max(1)
        IExpression expression61 =
                new MaxExpression(
                    new IntegerTerminal(1)
                );
    
        IAbstractQueryResult queryResult61 = interpreter.eval(expression61);
        System.out.println("ex61: max(1) = "+queryResult61.toString());


        // max(bag(1, 3.35, 3))
        IExpression expression62 =
                new MaxExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new DoubleTerminal(3.35)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
    
        IAbstractQueryResult queryResult62 = interpreter.eval(expression62);
        System.out.println("ex62: max(bag(1, 3.35, 3)) = "+queryResult62.toString());


        // min(1)
        IExpression expression63 =
                new MinExpression(
                    new IntegerTerminal(1)
                );
    
        IAbstractQueryResult queryResult63 = interpreter.eval(expression63);
        System.out.println("ex63: min(1) = "+queryResult63.toString());


        // min(bag(1.01, 2.35, 3))
        IExpression expression64 =
                new MinExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new DoubleTerminal(1.01),
                                new DoubleTerminal(2.35)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
    
        IAbstractQueryResult queryResult64 = interpreter.eval(expression64);
        System.out.println("ex64: min(bag(1.01, 2.35, 3)) = "+queryResult64.toString());


        // 10 - 5
        IExpression expression65 = 
                new MinusExpression(
                    new IntegerTerminal(10),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult65 = interpreter.eval(expression65);
        System.out.println("ex65: 10 - 5 = "+queryResult65.toString());
        

        // 5 - 3.50
        IExpression expression66 = 
                new MinusExpression(
                    new IntegerTerminal(5),
                    new DoubleTerminal(3.50)
                );
        
        IAbstractQueryResult queryResult66 = interpreter.eval(expression66);
        System.out.println("ex66: 5 - 3.50 = "+queryResult66.toString());
        

        // 3.50 - 5
        IExpression expression67 = 
                new MinusExpression(
                    new DoubleTerminal(3.50),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult67 = interpreter.eval(expression67);
        System.out.println("ex67: 3.50 - 5 = "+queryResult67.toString());
        

        // 3.50 - 5.50
        IExpression expression68 = 
                new MinusExpression(
                    new DoubleTerminal(3.50),
                    new DoubleTerminal(5.50)
                );
        
        IAbstractQueryResult queryResult68 = interpreter.eval(expression68);
        System.out.println("ex68: 3.50 - 5.50 = "+queryResult68.toString());
        

        // 10 % 5
        IExpression expression69 = 
                new ModuloExpression(
                    new IntegerTerminal(10),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult69 = interpreter.eval(expression69);
        System.out.println("ex69: 10 % 5 = "+queryResult69.toString());


        // 5 % 3.50
        IExpression expression70 = 
                new ModuloExpression(
                    new IntegerTerminal(5),
                    new DoubleTerminal(3.50)
                );
        
        IAbstractQueryResult queryResult70 = interpreter.eval(expression70);
        System.out.println("ex70: 5 % 3.50 = "+queryResult70.toString());
        

        // 3.50 % 5
        IExpression expression71 = 
                new ModuloExpression(
                    new DoubleTerminal(3.50),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult71 = interpreter.eval(expression71);
        System.out.println("ex71: 3.50 % 5 = "+queryResult71.toString());
        

        // 3.50 % 5.50
        IExpression expression72 = 
                new ModuloExpression(
                    new DoubleTerminal(3.50),
                    new DoubleTerminal(5.50)
                );
        
        IAbstractQueryResult queryResult72 = interpreter.eval(expression72);
        System.out.println("ex72: 3.50 % 5.50 = "+queryResult72.toString());
        

        // 10 * 5
        IExpression expression73 = 
                new MultiplyExpression(
                    new IntegerTerminal(10),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult73 = interpreter.eval(expression73);
        System.out.println("ex73: 10 * 5 = "+queryResult73.toString());
        
        
        // 5 * 3.50
        IExpression expression74 = 
                new MultiplyExpression(
                    new IntegerTerminal(5),
                    new DoubleTerminal(3.50)
                );
        
        IAbstractQueryResult queryResult74 = interpreter.eval(expression74);
        System.out.println("ex74: 5 * 3.50 = "+queryResult74.toString());
        
        
        // 3.50 * 5
        IExpression expression75 = 
                new MultiplyExpression(
                    new DoubleTerminal(3.50),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult75 = interpreter.eval(expression75);
        System.out.println("ex75: 3.50 * 5 = "+queryResult75.toString());


        // 3.50 * 5.50
        IExpression expression76 = 
                new MultiplyExpression(
                    new DoubleTerminal(3.50),
                    new DoubleTerminal(5.50)
                );
        
        IAbstractQueryResult queryResult76 = interpreter.eval(expression76);
        System.out.println("ex76: 3.50 * 5.50 = "+queryResult76.toString());


        // true or false
        IExpression expression77 = 
                new OrExpression(
                    new BooleanTerminal(true),
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult77 = interpreter.eval(expression77);
        System.out.println("ex77: true or false = "+queryResult77.toString());
        

        // booleanValue or false
        IExpression expression78 =
                new OrExpression(
                    new NameTerminal("booleanValue"),
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult78 = interpreter.eval(expression78);
        System.out.println("ex78: booleanValue or false = "+queryResult78.toString());

        
        // true or false or 1
        IExpression expression79 = 
                new OrExpression(
                    new OrExpression(
                        new BooleanTerminal(true),
                        new BooleanTerminal(false)
                    ),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult79 = interpreter.eval(expression79);
        System.out.println("ex79: true or false or 1 = "+queryResult79.toString());
        

        // 10 + 5
        IExpression expression80 = 
                new PlusExpression(
                    new IntegerTerminal(10),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult80 = interpreter.eval(expression80);
        System.out.println("ex80: 10 + 5 = "+queryResult80.toString());
        

        // 5 + 3.50
        IExpression expression81 = 
                new PlusExpression(
                    new IntegerTerminal(5),
                    new DoubleTerminal(3.50)
                );
        
        IAbstractQueryResult queryResult81 = interpreter.eval(expression81);
        System.out.println("ex81: 5 + 3.50 = "+queryResult81.toString());
        
        
        // 3.50 + 5
        IExpression expression82 = 
                new PlusExpression(
                    new DoubleTerminal(3.50),
                    new IntegerTerminal(5)
                );
        
        IAbstractQueryResult queryResult82 = interpreter.eval(expression82);
        System.out.println("ex82: 3.50 + 5 = "+queryResult82.toString());


        // 3.50 + 5.50
        IExpression expression83 = 
                new PlusExpression(
                    new DoubleTerminal(3.50),
                    new DoubleTerminal(5.50)
                );
        
        IAbstractQueryResult queryResult83 = interpreter.eval(expression83);
        System.out.println("ex83: 3.50 + 5.50 = "+queryResult83.toString());

        
        // 3 + "Ala"
        IExpression expression84 = 
                new PlusExpression(
                    new IntegerTerminal(3),
                    new StringTerminal("Ala")
                );
        
        IAbstractQueryResult queryResult84 = interpreter.eval(expression84);
        System.out.println("ex84: 3 + \"Ala\" = "+queryResult84.toString());

        
        // 3.50 + "Ala"
        IExpression expression85 = 
                new PlusExpression(
                    new DoubleTerminal(3.50),
                    new StringTerminal("Ala")
                );
        
        IAbstractQueryResult queryResult85 = interpreter.eval(expression85);
        System.out.println("ex85: 3.50 + \"Ala\" = "+queryResult85.toString());


        // "Ala" + 3.7
        IExpression expression86 = 
                new PlusExpression(
                    new StringTerminal("Ala"),
                    new DoubleTerminal(3.7)
                );
        
        IAbstractQueryResult queryResult86 = interpreter.eval(expression86);
        System.out.println("ex86: \"Ala\" + 3.7 = "+queryResult86.toString());
        

        // true + "Ala"
        IExpression expression87 = 
                new PlusExpression(
                    new BooleanTerminal(true),
                    new StringTerminal("Ala")
                );
        
        IAbstractQueryResult queryResult87 = interpreter.eval(expression87);
        System.out.println("ex87: true + \"Ala\" = "+queryResult87.toString());

        // struct(1)
        IExpression expression88 =
                new StructExpression(
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult88 = interpreter.eval(expression88);
        System.out.println("ex88: struct(1) = " + queryResult88.toString());
        

        // struct(1, 2, 3)
        IExpression expression89 =
                new StructExpression(
                    new CommaExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        ),
                        new IntegerTerminal(3)
                    )
                );
        
        IAbstractQueryResult queryResult89 = interpreter.eval(expression89);
        System.out.println("ex89: struct(1, 2, 3) = " + queryResult89.toString());
        

        // struct(1 + 2, 3)
        IExpression expression90 =
                new StructExpression(
                    new CommaExpression(
                        new PlusExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        ),
                        new IntegerTerminal(3)
                    )
                );
        
        IAbstractQueryResult queryResult90 = interpreter.eval(expression90);
        System.out.println("ex90: struct(1 + 2, 3) = " + queryResult90.toString());
        
        
        // struct(struct(1,2,3))
        IExpression expression91 =
                new StructExpression(
                    new StructExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    ) 
                );
        
        IAbstractQueryResult queryResult91 = interpreter.eval(expression91);
        System.out.println("ex91: struct(struct(1, 2, 3)) = " + queryResult91.toString());
        
        
        // 1 union 2
        IExpression expression92 = 
                new UnionExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(2)
                );
        
        IAbstractQueryResult queryResult92 = interpreter.eval(expression92);
        System.out.println("ex92: 1 union 2 = " + queryResult92.toString());

        
        // bag(1,2) union bag(3,4)
        IExpression expression93 = 
                new UnionExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(3),
                            new IntegerTerminal(4)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult93 = interpreter.eval(expression93);
        System.out.println("ex93: bag(1,2) union bag(3,4) = " + queryResult93.toString());

        
        // (1, 2) union (3, 4)
        IExpression expression94 = 
                new UnionExpression(
                    new CommaExpression(
                        new IntegerTerminal(1),
                        new IntegerTerminal(2)
                    ),
                    new CommaExpression(
                        new IntegerTerminal(3),
                        new IntegerTerminal(4)
                    )
                );
        
        IAbstractQueryResult queryResult94 = interpreter.eval(expression94);
        System.out.println("ex94: (1, 2) union (3, 4) = " + queryResult94.toString());

        
        // unique(bag(1, 2, 1))
        IExpression expression95 =
                new UniqueExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(1)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult95 = interpreter.eval(expression95);
        System.out.println("ex95: unique(bag(1, 2, 1)) = " + queryResult95.toString());
        

        // unique(bag(1.01, 2, 1.01, "ala"))
        IExpression expression96 =
                new UniqueExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new CommaExpression(
                                    new DoubleTerminal(1.01),
                                    new IntegerTerminal(2)
                                ),
                                new DoubleTerminal(1.01)
                            ),
                            new StringTerminal("ala")
                        )
                    )
                );
        
        IAbstractQueryResult queryResult96 = interpreter.eval(expression96);
        System.out.println("ex96: unique(bag(1.01, 2, 1.01, \"ala\")) = " + queryResult96.toString());
        

        // bag(1,2) where true
        IExpression expression97 =
                new WhereExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult97 = interpreter.eval(expression97);
        System.out.println("ex97: bag(1,2) where true = " + queryResult97.toString());

        
        // bag(1,2,3) as n where n == 1 
        IExpression expression98 =
                new WhereExpression(
                    new AsExpression(
                        new BagExpression(
                            new CommaExpression(
                                new CommaExpression(
                                    new IntegerTerminal(1),
                                    new IntegerTerminal(2)
                                ),
                                new IntegerTerminal(3)
                            )
                        ),
                        new NameTerminal("n").getName()
                    ),
                    new EqualsExpression(
                        new NameTerminal("n"),
                        new IntegerTerminal(1)
                    )
                );
        
        IAbstractQueryResult queryResult98 = interpreter.eval(expression98);
        System.out.println("ex98: (bag(1,2,3) as n) where (n == 1) = " + queryResult98.toString());
        
        
        // emp where married
        IExpression expression99 =
                new WhereExpression(
                    new NameTerminal("emp"),
                    new NameTerminal("married")
                );
        
        IAbstractQueryResult queryResult99 = interpreter.eval(expression99);
        System.out.println("ex99: emp where married = " + queryResult99.toString());
        

        // sum(1)
        IExpression expression100 =
                new SumExpression(
                    new IntegerTerminal(1)
                );
    
        IAbstractQueryResult queryResult100 = interpreter.eval(expression100);
        System.out.println("ex100: sum(1) = "+queryResult100.toString());
        

        // sum(bag(1.01, 2.35, 3))
        IExpression expression101 =
                new SumExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new DoubleTerminal(1.01),
                                new DoubleTerminal(2.35)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
    
        IAbstractQueryResult queryResult101 = interpreter.eval(expression101);
        System.out.println("ex101: sum(bag(1.01, 2.35, 3)) = "+queryResult101.toString());


        // count(1)
        IExpression expression102 = 
                new CountExpression(
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult102 = interpreter.eval(expression102);
        System.out.println("ex102: count(1) = " + queryResult102.toString());


        // count(bag(1.01, 2.35, 3))
        IExpression expression103 =
                new CountExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new DoubleTerminal(1.01),
                                new DoubleTerminal(2.35)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult103 = interpreter.eval(expression103);
        System.out.println("ex103: count(bag(1.01, 2.35, 3)) = " + queryResult103.toString());
        
        
        // count(1.01, 2.35, 3)
        IExpression expression104 =
                new CountExpression(
                    new CommaExpression(
                        new CommaExpression(
                            new DoubleTerminal(1.01),
                            new DoubleTerminal(2.35)
                        ),
                        new IntegerTerminal(3)
                    )
                );
        
        IAbstractQueryResult queryResult104 = interpreter.eval(expression104);
        System.out.println("ex104: count(1.01, 2.35, 3) = " + queryResult104.toString());
        

        // empty(1)
        IExpression expression105 = 
                new EmptyExpression(
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult105 = interpreter.eval(expression105);
        System.out.println("ex105: empty(1) = " + queryResult105.toString());


        // empty(bag(1.01, 2.35, 3))
        IExpression expression106 =
                new EmptyExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new DoubleTerminal(1.01),
                                new DoubleTerminal(2.35)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult106 = interpreter.eval(expression106);
        System.out.println("ex106: empty(bag(1.01, 2.35, 3)) = " + queryResult106.toString());
        
        
        // empty (1 where false)
        IExpression expression107 =
                new EmptyExpression(
                    new WhereExpression(
                        new IntegerTerminal(1),
                        new BooleanTerminal(false)
                    )
                );
        
        IAbstractQueryResult queryResult107 = interpreter.eval(expression107);
        System.out.println("ex107: empty (1 where false) = " + queryResult107.toString());


        // not true
        IExpression expression108 =
                new NotExpression(
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult108 = interpreter.eval(expression108);
        System.out.println("ex108: not(true) = " + queryResult108.toString());
        
        
        // not false
        IExpression expression109 =
                new NotExpression(
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult109 = interpreter.eval(expression109);
        System.out.println("ex109: not(false) = " + queryResult109.toString());
        
        
        // true xor false
        IExpression expression110 = 
                new XORExpression(
                    new BooleanTerminal(true),
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult110 = interpreter.eval(expression110);
        System.out.println("ex110: true xor false = "+queryResult110.toString());
        

        // true xor true
        IExpression expression111 = 
                new XORExpression(
                    new BooleanTerminal(true),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult111 = interpreter.eval(expression111);
        System.out.println("ex111: true xor true = "+queryResult111.toString());
                

        // false xor true
        IExpression expression112 = 
                new XORExpression(
                    new BooleanTerminal(false),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult112 = interpreter.eval(expression112);
        System.out.println("ex112: false xor true = "+queryResult112.toString());
        
        
        // booleanValue xor true
        IExpression expression113 =
                new XORExpression(
                    new NameTerminal("booleanValue"),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult113 = interpreter.eval(expression113);
        System.out.println("ex113: booleanValue xor true = "+queryResult113.toString());
        

        // true nand false
        IExpression expression114 = 
                new NAndExpression(
                    new BooleanTerminal(true),
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult114 = interpreter.eval(expression114);
        System.out.println("ex114: true nand false = "+queryResult114.toString());
        

        // false nand true
        IExpression expression115 = 
                new NAndExpression(
                    new BooleanTerminal(false),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult115 = interpreter.eval(expression115);
        System.out.println("ex115: false nand true = "+queryResult115.toString());


        // false nand false
        IExpression expression116 = 
                new NAndExpression(
                    new BooleanTerminal(false),
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult116 = interpreter.eval(expression116);
        System.out.println("ex116: false nand false = "+queryResult116.toString());

        
        // true nand true
        IExpression expression117 = 
                new NAndExpression(
                    new BooleanTerminal(true),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult117 = interpreter.eval(expression117);
        System.out.println("ex117: true nand true = "+queryResult117.toString());
        

        // booleanValue nand true
        IExpression expression118 =
                new NAndExpression(
                    new NameTerminal("booleanValue"),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult118 = interpreter.eval(expression118);
        System.out.println("ex118: booleanValue nand true = "+queryResult118.toString());

        
        // bag(2, 3) in bag(1, 2, 3)
        IExpression expression119 =
                new InExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new IntegerTerminal(3)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult119 = interpreter.eval(expression119);
        System.out.println("ex119: bag(2, 3) in bag(1, 2, 3) = " + queryResult119.toString());
        
        
        // 1 in 1
        IExpression expression120 = 
                new InExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult120 = interpreter.eval(expression120);
        System.out.println("ex120: 1 in 1 = "+queryResult120.toString());
        
        
        // bag(1, 2) in bag(2, 3)
        IExpression expression121 = 
                new InExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult121 = interpreter.eval(expression121);
        System.out.println("ex121: bag(1, 2) in bag(2, 3) = "+queryResult121.toString());
        

        // bag(1, 2) in bag(1, 2)
        IExpression expression122 = 
                new InExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult122 = interpreter.eval(expression122);
        System.out.println("ex122: bag(1, 2) in bag(1, 2) = "+queryResult122.toString());


        // bag(1) minus bag(1.0)
        IExpression expression123 =
                new MinusExpression(
                    new BagExpression(
                        new IntegerTerminal(1)
                    ),
                    new BagExpression(
                        new DoubleTerminal(1.0)
                    )
                );
        
        IAbstractQueryResult queryResult123 = interpreter.eval(expression123);
        System.out.println("ex123: bag(1) minus bag(1.0) = " + queryResult123.toString());


        // bag(1, 2, 3) minusSet bag(2, 3)
        IExpression expression124 =
                new MinusSetExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult124 = interpreter.eval(expression124);
        System.out.println("ex124: bag(1, 2, 3) minusSet bag(2, 3) = " + queryResult124.toString());
        

        // 1 minusSet 1
        IExpression expression125 = 
                new MinusSetExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult125 = interpreter.eval(expression125);
        System.out.println("ex125: 1 minusSet 1 = "+queryResult125.toString());


        // 1 minus 1
        IExpression expression126 = 
                new MinusExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult126 = interpreter.eval(expression126);
        System.out.println("ex126: 1 minus 1 = "+queryResult126.toString());
        

        // (1, 2) minusSet (2, 3)
        IExpression expression127 =
                new MinusSetExpression(
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult127 = interpreter.eval(expression127);
        System.out.println("ex127: (1, 2) minusSet (2, 3) = " + queryResult127.toString());


        // bag(1, 2) minusSet bag(2, 3)
        IExpression expression128 =
                new MinusSetExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult128 = interpreter.eval(expression128);
        System.out.println("ex128: bag(1, 2) minusSet bag(2, 3) = " + queryResult128.toString());

        
        // (1, 2) minusSet (1, 2)
        IExpression expression129 =
                new MinusSetExpression(
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult129 = interpreter.eval(expression129);
        System.out.println("ex129: (1, 2) minusSet (1, 2) = " + queryResult129.toString());


        // bag(1, 2) minusSet bag(1, 2)
        IExpression expression130 =
                new MinusSetExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult130 = interpreter.eval(expression130);
        System.out.println("ex130: bag(1, 2) minusSet bag(1, 2) = " + queryResult130.toString());


        // bag(2, 3.40) minusSet bag("ala", 2, 3) 
        IExpression expression131 =
                new MinusSetExpression(
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new DoubleTerminal(3.40)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new StringTerminal("ala"),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    )
                );
    
        IAbstractQueryResult queryResult131 = interpreter.eval(expression131);
        System.out.println("ex131: bag(2, 3.40) minusSet bag(\"ala\", 2, 3) = "+queryResult131.toString());

        
        // bag("ala", 2, 3) minusSet bag(2, 3.40)
        IExpression expression132 =
                new MinusSetExpression(
                    new BagExpression(
                        new CommaExpression(
                            new CommaExpression(
                                new StringTerminal("ala"),
                                new IntegerTerminal(2)
                            ),
                            new IntegerTerminal(3)
                        )
                    ),
                    new BagExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new DoubleTerminal(3.40)
                        )
                    )
                );
    
        IAbstractQueryResult queryResult132 = interpreter.eval(expression132);
        System.out.println("ex132: bag(\"ala\", 2, 3) minusSet bag(2, 3.40) = "+queryResult132.toString());
        
                
        // (1, 2) in (2, 3)
        IExpression expression133 = 
                new InExpression(
                    new CommaExpression(
                        new IntegerTerminal(1),
                        new IntegerTerminal(2)
                    ),
                    new CommaExpression(
                        new IntegerTerminal(2),
                        new IntegerTerminal(3)
                    )
                );
        
        IAbstractQueryResult queryResult133 = interpreter.eval(expression133);
        System.out.println("ex133: (1, 2) in (2, 3) = "+queryResult133.toString());
        

        // (1, 2) in (1, 2)
        IExpression expression134 = 
                new InExpression(
                    new CommaExpression(
                        new IntegerTerminal(1),
                        new IntegerTerminal(2)
                    ),
                    new CommaExpression(
                        new IntegerTerminal(1),
                        new IntegerTerminal(2)
                    )
                );
        
        IAbstractQueryResult queryResult134 = interpreter.eval(expression134);
        System.out.println("ex134: (1, 2) in (1, 2) = "+queryResult134.toString());
        
        
        // emp join married
        IExpression expression135 =
                new JoinExpression(
                    new NameTerminal("emp"),
                    new NameTerminal("married")
                );
        
        IAbstractQueryResult queryResult135 = interpreter.eval(expression135);
        System.out.println("ex135: emp join married = " + queryResult135.toString());
 
        // false nand 1
        IExpression expression136 = 
                new NAndExpression(
                    new BooleanTerminal(false),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult136 = interpreter.eval(expression136);
        System.out.println("ex136: false nand 1 = "+queryResult136.toString());

/*
        // Below should be an Exception during evaluation.
        // (There is an exception during evaluation so this example is commented.)
        
        // true nand 1
        IExpression expression137 = 
                new NAndExpression(
                    new BooleanTerminal(true),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult137 = interpreter.eval(expression137);
        System.out.println("ex137: true nand 1 = "+queryResult137.toString());


        // true nand false nand 1
        IExpression expression138 = 
                new NAndExpression(
                    new NAndExpression(
                        new BooleanTerminal(true),
                        new BooleanTerminal(false)
                    ),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult138 = interpreter.eval(expression138);
        System.out.println("ex138: true nand false nand 1 = "+queryResult138.toString());

        
        // 1 nand false
        IExpression expression139 = 
                new NAndExpression(
                    new IntegerTerminal(1),
                    new BooleanTerminal(false)
                );
        
        IAbstractQueryResult queryResult139 = interpreter.eval(expression139);
        System.out.println("ex139: 1 nand false = "+queryResult139.toString());


        // 1 nand true
        IExpression expression140 = 
                new NAndExpression(
                    new IntegerTerminal(1),
                    new BooleanTerminal(true)
                );
        
        IAbstractQueryResult queryResult140 = interpreter.eval(expression140);
        System.out.println("ex140: 1 nand true = "+queryResult140.toString());


        // 1 nand 1
        IExpression expression141 = 
                new NAndExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(1)
                );
        
        IAbstractQueryResult queryResult141 = interpreter.eval(expression141);
        System.out.println("ex141: 1 nand 1 = "+queryResult141.toString());
        
                
        // Above should be an Exception during evaluation.
        // (There is an exception during evaluation so this example is commented.)
*/
        
        // struct(1, 2) intersect struct(2, 3)
        IExpression expression142 =
                new IntersectExpression(
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(2),
                            new IntegerTerminal(3)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult142 = interpreter.eval(expression142);
        System.out.println("ex142: struct(1, 2) intersect struct(2, 3) = "+queryResult142.toString());
        
        
        // struct(1, 2) intersect struct(1, 2)
        IExpression expression143 =
                new IntersectExpression(
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    ),
                    new StructExpression(
                        new CommaExpression(
                            new IntegerTerminal(1),
                            new IntegerTerminal(2)
                        )
                    )
                );
        
        IAbstractQueryResult queryResult143 = interpreter.eval(expression143);
        System.out.println("ex143: struct(1, 2) intersect struct(1, 2) = "+queryResult143.toString());
        
        
        // 1 >= 1
        IExpression expression144 =
                new GreaterOrEqualThanExpression(
                    new IntegerTerminal(1),
                    new IntegerTerminal(1)
                );

        IAbstractQueryResult queryResult144 = interpreter.eval(expression144);
        System.out.println("ex144: (1 >= 1) = "+queryResult144.toString());

        
        // 3 >= 2.99
        IExpression expression145 =
                new GreaterOrEqualThanExpression(
                    new IntegerTerminal(3),
                    new DoubleTerminal(2.99)
                );

        IAbstractQueryResult queryResult145 = interpreter.eval(expression145);
        System.out.println("ex145: (3 >= 2.99) = "+queryResult145.toString());
        
        
        // 3.50 - 3.50
        IExpression expression146 = 
                new MinusExpression(
                    new DoubleTerminal(3.50),
                    new DoubleTerminal(3.50)
                );
        
        IAbstractQueryResult queryResult146 = interpreter.eval(expression146);
        System.out.println("ex146: 3.50 - 3.50 = "+queryResult146.toString());

        
        // (bag(1, 2) minusSet bag(1, 2)) minusSet (bag(1, 2) minusSet bag(1, 2))
        IExpression expression147 =
                new MinusSetExpression(
                    new MinusSetExpression(
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            )
                        ),
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            )
                        )
                    ),
                    new MinusSetExpression(
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            )
                        ),
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            )
                        )
                    )
                );
        
        IAbstractQueryResult queryResult147 = interpreter.eval(expression147);
        System.out.println("ex147: (bag(1, 2) minusSet bag(1, 2)) minusSet (bag(1, 2) minusSet bag(1, 2)) = " + queryResult147.toString());
        
        
        // (bag(1, 3) minusSet bag(1, 4)) minusSet (bag(1, 3) minusSet bag(1, 2))
        IExpression expression148 =
                new MinusSetExpression(
                    new MinusSetExpression(
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(3)
                            )
                        ),
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(4)
                            )
                        )
                    ),
                    new MinusSetExpression(
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(3)
                            )
                        ),
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            )
                        )
                    )
                );
        
        IAbstractQueryResult queryResult148 = interpreter.eval(expression148);
        System.out.println("ex148: (bag(1, 3) minusSet bag(1, 4)) minusSet (bag(1, 3) minusSet bag(1, 2)) = " + queryResult148.toString());

        
        // (bag(1 < 3) minusSet bag(1 <= 4)) minusSet (bag(1, 3) minusSet bag(1, 2))
        IExpression expression149 =
                new MinusSetExpression(
                    new MinusSetExpression(
                        new BagExpression(
                            new LessThanExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(3)
                            )
                        ),
                        new BagExpression(
                            new LessOrEqualThanExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(4)
                            )
                        )
                    ),
                    new MinusSetExpression(
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(3)
                            )
                        ),
                        new BagExpression(
                            new CommaExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(2)
                            )
                        )
                    )
                );
        
        IAbstractQueryResult queryResult149 = interpreter.eval(expression149);
        System.out.println("ex149: (bag(1 < 3) minusSet bag(1 <= 4)) minusSet (bag(1, 3) minusSet bag(1, 2)) = " + queryResult149.toString());

        
        // (bag(1 < 3) minusSet bag(1 <= 4)) union (bag(1 < 3) minusSet bag(2 <= 1))
        IExpression expression150 =
                new UnionExpression(
                    new MinusSetExpression(
                        new BagExpression(
                            new LessThanExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(3)
                            )
                        ),
                        new BagExpression(
                            new LessOrEqualThanExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(4)
                            )
                        )
                    ),
                    new MinusSetExpression(
                        new BagExpression(
                            new LessThanExpression(
                                new IntegerTerminal(1),
                                new IntegerTerminal(3)
                            )
                        ),
                        new BagExpression(
                            new LessOrEqualThanExpression(
                                new IntegerTerminal(2),
                                new IntegerTerminal(1)
                            )
                        )
                    )
                );
        
        IAbstractQueryResult queryResult150 = interpreter.eval(expression150);
        System.out.println("ex150: (bag(1 < 3) minusSet bag(1 <= 4)) union (bag(1 < 3) minusSet bag(2 <= 1)) = " + queryResult150.toString());
    }
}